foldingtest is package{
  import treemap;
  -- test the folding stuff
  
  main() do {
    L is cons of {1;2;3;4};
    
    T is treemap of {1 -> "one"; 2->"two"; 3->"three"};
    
    assert rightFold((+),0,L) = leftFold((+),0,L)
    
    logMsg(info,"fold T= $(leftFold(_concat,"",T))");
    
    assert leftFold(_concat,"",T)="onetwothree";
    
    logMsg(info,"sub = $(leftFold((-),0,L))");
    logMsg(info,"sub = $(rightFold((-),0,L))");
    
    assert leftFold((-),0,L)=-10;
  }
}